import {
	https
} from "./router";



//获取首页轮播图
export function getBanner() {
	return https({
		url: 'api/index/getSlides?type=index',
		method: 'GET'
	})
}

//首页公告
export function getDynamics() {
	return https({
		url: 'api/index/getDynamics',
		method: 'GET'
	})
}

//公告列表
export function Document() {
	return https({
		url: 'api/Document/index',
		method: 'GET'
	})
}

//公告详情
export function Documentread(data) {
	return https({
		url: `api/Document/read?id=${data.id}`,
		method: 'GET'
	})
}

//首页商品列表
export function list(data) {
	return https({
		url: `api/Productlists/listsByField?page_size=${data.page_size}&field=${data.field}&page=${data.page}`,
		method: 'GET'
	})
}

//首页商品列表
export function indexList(data) {
	return https({
		url: `api/Productlists/listsByField?page_size=${data.page_size}&field=${data.field}&category_id=${data.category_id}&page=${data.page}&keyword=${data.keyword}`,
		method: 'GET'
	})
}

//商品分类
export function getCates() {
	return https({
		url: 'api/index/cates',
		method: 'GET'
	})
}

//商品详情
export function getDetail(data) {
	return https({
		url: `api/Productlists/read?id=${data.id}`,
		method: 'GET'
	})
}

//商品sku
export function sku(data) {
	return https({
		url: `api/Productlists/sku?product_id=${data.product_id}&attrs=${data.attrs}`,
		method: 'GET'
	})
}

//加入购物车
export function create(data) {
	return https({
		url: `api/Productcart/create`,
		method: 'POST',
		data
	})
}

//立即购买
export function preOrder(data) {
	return https({
		url: `api/Productlisto/preOrder`,
		method: 'POST',
		data
	})
}

//查看订单状态
export function checkOrder(data){
	return https({
		url:'api/Productorder/checkOrder',
		method:'POST',
		data
	})
}

//提交订单
export function createorder(data) {
	return https({
		url: `api/Productorder/createorder`,
		method: 'POST',
		data
	})
}

//支付
export function payNow(data) {
	return https({
		url: `api/Productorder/pay`,
		method: 'POST',
		data
	})
}

//获取商品清单
export function getOrder(data) {
	return https({
		url: `api/Productlisto/getOrder`,
		method: 'POST',
		data
	})
}

//获取默认地址
export function readd() {
	return https({
		url: `api/Transport/readd`,
		method: 'POST',
	})
}

//购物车列表
export function cartList() {
	return https({
		url: `api/Productcart/lists`,
		method: 'POST',
	})
}

//购物车删除
export function cartDel(data) {
	return https({
		url: `api/Productcart/del`,
		method: 'POST',
		data
	})
}

//地址列表
export function Transport() {
	return https({
		url: `api/Transport/index`,
		method: 'POST',
	})
}

//添加/编辑/修改默认 地址
export function address(data) {
	return https({
		url: `api/Transport/address`,
		method: 'POST',
		data
	})
}

//地址详情
export function read(data) {
	return https({
		url: `api/Transport/read`,
		method: 'POST',
		data
	})
}

//删除地址
export function deleteAdd(data) {
	return https({
		url: `api/Transport/delete`,
		method: 'POST',
		data
	})
}

//省市区列表
export function District() {
	return https({
		url: `api/District/lists`,
		method: 'POST',
	})
}

//订单列表
export function Productorder(data) {
	return https({
		url: `api/Productorder/lists`,
		method: 'POST',
		data
	})
}

//订单详情
export function confirmOrder(data) {
	return https({
		url: `api/Productorder/confirmOrder`,
		method: 'POST',
		data
	})
}

//会员反馈
export function suggest(data) {
	return https({
		url: `api/user/suggest`,
		method: 'POST',
		data
	})
}

//修改密码
export function changepwd(data) {
	return https({
		url: 'api/user/changepwd',
		method: 'POST',
		data
	})
}

//获取配置信息
export function getConfigs(data) {
	return https({
		url: 'api/index/getConfigs',
		method: 'GET',
		data
	})
}

//注销账号
export function goHidden() {
	return https({
		url: 'api/user/goHidden',
		method: 'GET',
	})
}

